﻿Imports System
Imports System.IO
Imports System.Runtime.Serialization
Imports System.Runtime.Serialization.Formatters.Binary
<Serializable()> Public Class GridCon
    Private m_GridCon(-1, -1) As ResultCon
    Private m_GridMaxCon As New ResultCon  '储存网格中浓度最大值
    Private m_MaxValueCon As Double = 9999999 '网格最大浓度值
    Private m_MinValueCon As Double = 0 '网格最小浓度值
    
    Private m_GridConContourFileName As String '用于储存背景贡献浓度的等值线文件名称
    Private m_GridBackContourFileName As String '用于储存背景背景浓度的等值线文件名称
    Private m_GridAddContourFileName As String '用于储存背景叠加浓度的等值线文件名称
    ''' <summary>
    ''' 网格点的浓度
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Property GridCon() As ResultCon(,)
        Get
            Return Me.m_GridCon
        End Get
        Set(ByVal value As ResultCon(,))
            Me.m_GridCon = value
        End Set
    End Property
    ''' <summary>
    ''' 用于储存背景贡献浓度的等值线文件名称
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Property GridConContourFileName() As String
        Get
            Return Me.m_GridConContourFileName
        End Get
        Set(ByVal value As String)
            Me.m_GridConContourFileName = value
        End Set
    End Property
    ''' <summary>
    ''' 用于储存背景背景浓度的等值线文件名称
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Property GridBackContourFileName() As String
        Get
            Return Me.m_GridBackContourFileName
        End Get
        Set(ByVal value As String)
            Me.m_GridBackContourFileName = value
        End Set
    End Property
    ''' <summary>
    ''' 用于储存背景叠加浓度的等值线文件名称
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Property GridAddContourFileName() As String
        Get
            Return Me.m_GridAddContourFileName
        End Get
        Set(ByVal value As String)
            Me.m_GridAddContourFileName = value
        End Set
    End Property
    ''' <summary>
    ''' 储存网格中的最大值
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Property GridMaxCon() As ResultCon
        Get
            Return Me.m_GridMaxCon
        End Get
        Set(ByVal value As ResultCon)
            Me.m_GridMaxCon = value
        End Set
    End Property
    ''' <summary>
    ''' 网格点的最大值 
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Property MaxValueCon() As Double
        Get
            Return Me.m_MaxValueCon
        End Get
        Set(ByVal value As Double)
            Me.m_MaxValueCon = value
        End Set
    End Property

    ''' <summary>
    ''' 网格点的最小值
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Property MinValueCon() As Double
        Get
            Return Me.m_MinValueCon
        End Get
        Set(ByVal value As Double)
            Me.m_MinValueCon = value
        End Set
    End Property
    ''' <summary>
    ''' 计算最大值和最小值
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub CalMaxAndMinValue(ByVal Xnum As Integer, ByVal Ynum As Integer)
        Me.m_MaxValueCon = Me.m_GridCon(0, 0).con
        Me.m_MinValueCon = Me.m_GridCon(0, 0).con
        For i As Integer = 0 To Ynum - 1
            For j As Integer = 0 To Xnum - 1
                If Me.m_MaxValueCon < Me.m_GridCon(i, j).con Then
                    Me.m_MaxValueCon = Me.m_GridCon(i, j).con
                End If
                If Me.m_MinValueCon > Me.m_GridCon(i, j).con Then
                    Me.m_MinValueCon = Me.m_GridCon(i, j).con
                End If
            Next
        Next
    End Sub

End Class
